package com.guigusuqi.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.guigusuqi.user.entity.SysUserRole;
import com.guigusuqi.user.mapper.SysUserRoleMapper;
import com.guigusuqi.user.service.SysUserRoleService;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author suqi
 * @since 2023-02-24
 */
@Service
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements SysUserRoleService {

    @Override
    public boolean isHandPerson(String userId) {
        LambdaQueryWrapper<SysUserRole> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(SysUserRole::getUserId,userId);
        SysUserRole one = getOne(wrapper);
        if("4".equals(one.getRoleId())){
            return true;
        }
        return false;
    }

    @Override
    public boolean isSecretPerson(String userId) {
        LambdaQueryWrapper<SysUserRole> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(SysUserRole::getUserId,userId);
        SysUserRole one = getOne(wrapper);
        if("2".equals(one.getRoleId())){
            return true;
        }
        return false;
    }
}
